//
//  KLSGSpeakBrifController.m
//  KaoLaShiGuangFM
//
//  Created by lanou3g on 15/10/31.
//  Copyright © 2015年 com.lanou3g. All rights reserved.
//

#import "KLSGSpeakBrifController.h"

@interface KLSGSpeakBrifController ()

@end

@implementation KLSGSpeakBrifController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIScrollView *bgScroller = [[UIScrollView alloc] initWithFrame:self.view.frame];
    bgScroller.bounces = NO;
    bgScroller.showsVerticalScrollIndicator = NO;
    [self.view addSubview:bgScroller];
    UITapGestureRecognizer *tapG = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapG)];
    [bgScroller addGestureRecognizer:tapG];
    
    self.view.backgroundColor = [UIColor whiteColor];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.frame];
    [imageView sd_setImageWithURL:[NSURL URLWithString:self.model.coverLarge] placeholderImage:nil];
    imageView.alpha = 0.5;
    [bgScroller addSubview:imageView];
    
    UILabel *albumLable = [[UILabel alloc] initWithFrame:CGRectMake((kScreenWidth - 200) / 2, 100, 200, 50)];
    albumLable.text = [NSString stringWithFormat:@"专辑名称: %@", self.model.title];
    [bgScroller addSubview:albumLable];
    
    UILabel *speakLable = [[UILabel alloc] initWithFrame:CGRectMake((kScreenWidth - 200) / 2, CGRectGetMaxY(albumLable.frame), 200, 50)];
    speakLable.text = [NSString stringWithFormat:@"创建人: %@" ,self.model.nickname];
    [bgScroller addSubview:speakLable];
    
    UILabel *tagsLable = [[UILabel alloc] initWithFrame:CGRectMake((kScreenWidth - 200) / 2, CGRectGetMaxY(speakLable.frame), 200, 50)];
    tagsLable.text = [NSString stringWithFormat:@"标签: %@", self.model.tags ];
    tagsLable.numberOfLines = 0;
    [bgScroller addSubview:tagsLable];
    
    UILabel *brifLable = [[UILabel alloc] initWithFrame:CGRectMake((kScreenWidth - 200) / 2, CGRectGetMaxY(tagsLable.frame), 200, 300)];
    brifLable.text = [NSString stringWithFormat:@"简介: %@", self.model.intro];
    brifLable.font = [UIFont systemFontOfSize:16];
    brifLable.numberOfLines = 0;
    [bgScroller addSubview:brifLable];
    
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:16] forKey:NSFontAttributeName];
    CGRect frame = [brifLable.text boundingRectWithSize:CGSizeMake(200, 2000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:dic context:nil];
    CGRect newFrame = brifLable.frame;
    newFrame.size.height = frame.size.height;
    brifLable.frame = newFrame;
    
    bgScroller.contentSize = CGSizeMake(kScreenWidth, CGRectGetMaxY(brifLable.frame) + 70);
    if (bgScroller.contentSize.height > kScreenHeight) {
        imageView.frame = CGRectMake(0, 0, kScreenWidth, bgScroller.contentSize.height);
    }
}

- (void)tapG
{
    [self dismissViewControllerAnimated:YES completion:nil];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
